<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - id:000977,sync:fuzzer2,src:001052.lcov_info_final - src/nodeevents.cpp</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">src</a> - nodeevents.cpp<span style="font-size: 80%;"> (source / <a href="nodeevents.cpp.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">id:000977,sync:fuzzer2,src:001052.lcov_info_final</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">60</td>
            <td class="headerCovTableEntry">61</td>
            <td class="headerCovTableEntryHi">98.4 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2016-03-13 10:42:47</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">7</td>
            <td class="headerCovTableEntry">7</td>
            <td class="headerCovTableEntryHi">100.0 %</td>
          </tr>
          <tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : #include &quot;nodeevents.h&quot;</a>
<span class="lineNum">       2 </span>            : #include &quot;yaml-cpp/eventhandler.h&quot;
<span class="lineNum">       3 </span>            : #include &quot;yaml-cpp/mark.h&quot;
<span class="lineNum">       4 </span>            : #include &quot;yaml-cpp/node/detail/node.h&quot;
<span class="lineNum">       5 </span>            : #include &quot;yaml-cpp/node/detail/node_iterator.h&quot;
<span class="lineNum">       6 </span>            : #include &quot;yaml-cpp/node/node.h&quot;
<span class="lineNum">       7 </span>            : #include &quot;yaml-cpp/node/type.h&quot;
<a name="8"><span class="lineNum">       8 </span>            : </a>
<span class="lineNum">       9 </span>            : namespace YAML {
<span class="lineNum">      10 </span><span class="lineCov">       1131 : void NodeEvents::AliasManager::RegisterReference(const detail::node&amp; node) {</span>
<span class="lineNum">      11 </span><span class="lineCov">       1131 :   m_anchorByIdentity.insert(std::make_pair(node.ref(), _CreateNewAnchor()));</span>
<a name="12"><span class="lineNum">      12 </span><span class="lineCov">       1131 : }</span></a>
<span class="lineNum">      13 </span>            : 
<span class="lineNum">      14 </span><span class="lineCov">       4252 : anchor_t NodeEvents::AliasManager::LookupAnchor(</span>
<span class="lineNum">      15 </span>            :     const detail::node&amp; node) const {
<span class="lineNum">      16 </span><span class="lineCov">       4252 :   AnchorByIdentity::const_iterator it = m_anchorByIdentity.find(node.ref());</span>
<span class="lineNum">      17 </span><span class="lineCov">       4252 :   if (it == m_anchorByIdentity.end())</span>
<span class="lineNum">      18 </span><span class="lineCov">       1131 :     return 0;</span>
<span class="lineNum">      19 </span><span class="lineCov">       3121 :   return it-&gt;second;</span>
<a name="20"><span class="lineNum">      20 </span>            : }</a>
<span class="lineNum">      21 </span>            : 
<span class="lineNum">      22 </span><span class="lineCov">       1081 : NodeEvents::NodeEvents(const Node&amp; node)</span>
<span class="lineNum">      23 </span><span class="lineCov">       1081 :     : m_pMemory(node.m_pMemory), m_root(node.m_pNode) {</span>
<span class="lineNum">      24 </span><span class="lineCov">       1081 :   if (m_root)</span>
<span class="lineNum">      25 </span><span class="lineCov">        945 :     Setup(*m_root);</span>
<a name="26"><span class="lineNum">      26 </span><span class="lineCov">       1081 : }</span></a>
<span class="lineNum">      27 </span>            : 
<span class="lineNum">      28 </span><span class="lineCov">      54806 : void NodeEvents::Setup(const detail::node&amp; node) {</span>
<span class="lineNum">      29 </span><span class="lineCov">      54806 :   int&amp; refCount = m_refCount[node.ref()];</span>
<span class="lineNum">      30 </span><span class="lineCov">      54806 :   refCount++;</span>
<span class="lineNum">      31 </span><span class="lineCov">      54806 :   if (refCount &gt; 1)</span>
<span class="lineNum">      32 </span><span class="lineCov">       1990 :     return;</span>
<span class="lineNum">      33 </span>            : 
<span class="lineNum">      34 </span><span class="lineCov">      52816 :   if (node.type() == NodeType::Sequence) {</span>
<span class="lineNum">      35 </span><span class="lineCov">      23688 :     for (detail::const_node_iterator it = node.begin(); it != node.end(); ++it)</span>
<span class="lineNum">      36 </span><span class="lineCov">      17349 :       Setup(**it);</span>
<span class="lineNum">      37 </span><span class="lineCov">      46477 :   } else if (node.type() == NodeType::Map) {</span>
<span class="lineNum">      38 </span><span class="lineCov">      29438 :     for (detail::const_node_iterator it = node.begin(); it != node.end();</span>
<span class="lineNum">      39 </span>            :          ++it) {
<span class="lineNum">      40 </span><span class="lineCov">      18256 :       Setup(*it-&gt;first);</span>
<span class="lineNum">      41 </span><span class="lineCov">      18256 :       Setup(*it-&gt;second);</span>
<span class="lineNum">      42 </span>            :     }
<span class="lineNum">      43 </span>            :   }
<a name="44"><span class="lineNum">      44 </span>            : }</a>
<span class="lineNum">      45 </span>            : 
<span class="lineNum">      46 </span><span class="lineCov">       1081 : void NodeEvents::Emit(EventHandler&amp; handler) {</span>
<span class="lineNum">      47 </span><span class="lineCov">       2162 :   AliasManager am;</span>
<span class="lineNum">      48 </span>            : 
<span class="lineNum">      49 </span><span class="lineCov">       1081 :   handler.OnDocumentStart(Mark());</span>
<span class="lineNum">      50 </span><span class="lineCov">       1081 :   if (m_root)</span>
<span class="lineNum">      51 </span><span class="lineCov">        945 :     Emit(*m_root, handler, am);</span>
<span class="lineNum">      52 </span><span class="lineCov">       1081 :   handler.OnDocumentEnd();</span>
<a name="53"><span class="lineNum">      53 </span><span class="lineCov">       1081 : }</span></a>
<span class="lineNum">      54 </span>            : 
<span class="lineNum">      55 </span><span class="lineCov">      54806 : void NodeEvents::Emit(const detail::node&amp; node, EventHandler&amp; handler,</span>
<span class="lineNum">      56 </span>            :                       AliasManager&amp; am) const {
<span class="lineNum">      57 </span><span class="lineCov">      54806 :   anchor_t anchor = NullAnchor;</span>
<span class="lineNum">      58 </span><span class="lineCov">      54806 :   if (IsAliased(node)) {</span>
<span class="lineNum">      59 </span><span class="lineCov">       3121 :     anchor = am.LookupAnchor(node);</span>
<span class="lineNum">      60 </span><span class="lineCov">       3121 :     if (anchor) {</span>
<span class="lineNum">      61 </span><span class="lineCov">       1990 :       handler.OnAlias(Mark(), anchor);</span>
<span class="lineNum">      62 </span><span class="lineCov">       1990 :       return;</span>
<span class="lineNum">      63 </span>            :     }
<span class="lineNum">      64 </span>            : 
<span class="lineNum">      65 </span><span class="lineCov">       1131 :     am.RegisterReference(node);</span>
<span class="lineNum">      66 </span><span class="lineCov">       1131 :     anchor = am.LookupAnchor(node);</span>
<span class="lineNum">      67 </span>            :   }
<span class="lineNum">      68 </span>            : 
<span class="lineNum">      69 </span><span class="lineCov">      52816 :   switch (node.type()) {</span>
<span class="lineNum">      70 </span>            :     case NodeType::Undefined:
<span class="lineNum">      71 </span><span class="lineNoCov">          0 :       break;</span>
<span class="lineNum">      72 </span>            :     case NodeType::Null:
<span class="lineNum">      73 </span><span class="lineCov">      21598 :       handler.OnNull(Mark(), anchor);</span>
<span class="lineNum">      74 </span><span class="lineCov">      21598 :       break;</span>
<span class="lineNum">      75 </span>            :     case NodeType::Scalar:
<span class="lineNum">      76 </span><span class="lineCov">      13697 :       handler.OnScalar(Mark(), node.tag(), anchor, node.scalar());</span>
<span class="lineNum">      77 </span><span class="lineCov">      13697 :       break;</span>
<span class="lineNum">      78 </span>            :     case NodeType::Sequence:
<span class="lineNum">      79 </span><span class="lineCov">       6339 :       handler.OnSequenceStart(Mark(), node.tag(), anchor, node.style());</span>
<span class="lineNum">      80 </span><span class="lineCov">      23688 :       for (detail::const_node_iterator it = node.begin(); it != node.end();</span>
<span class="lineNum">      81 </span>            :            ++it)
<span class="lineNum">      82 </span><span class="lineCov">      17349 :         Emit(**it, handler, am);</span>
<span class="lineNum">      83 </span><span class="lineCov">       6339 :       handler.OnSequenceEnd();</span>
<span class="lineNum">      84 </span><span class="lineCov">       6339 :       break;</span>
<span class="lineNum">      85 </span>            :     case NodeType::Map:
<span class="lineNum">      86 </span><span class="lineCov">      11182 :       handler.OnMapStart(Mark(), node.tag(), anchor, node.style());</span>
<span class="lineNum">      87 </span><span class="lineCov">      29438 :       for (detail::const_node_iterator it = node.begin(); it != node.end();</span>
<span class="lineNum">      88 </span>            :            ++it) {
<span class="lineNum">      89 </span><span class="lineCov">      18256 :         Emit(*it-&gt;first, handler, am);</span>
<span class="lineNum">      90 </span><span class="lineCov">      18256 :         Emit(*it-&gt;second, handler, am);</span>
<span class="lineNum">      91 </span>            :       }
<span class="lineNum">      92 </span><span class="lineCov">      11182 :       handler.OnMapEnd();</span>
<span class="lineNum">      93 </span><span class="lineCov">      11182 :       break;</span>
<span class="lineNum">      94 </span>            :   }
<a name="95"><span class="lineNum">      95 </span>            : }</a>
<span class="lineNum">      96 </span>            : 
<span class="lineNum">      97 </span><span class="lineCov">      54806 : bool NodeEvents::IsAliased(const detail::node&amp; node) const {</span>
<span class="lineNum">      98 </span><span class="lineCov">      54806 :   RefCount::const_iterator it = m_refCount.find(node.ref());</span>
<span class="lineNum">      99 </span><span class="lineCov">      54806 :   return it != m_refCount.end() &amp;&amp; it-&gt;second &gt; 1;</span>
<span class="lineNum">     100 </span>            : }
<span class="lineNum">     101 </span>            : }
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.11</a></td></tr>
  </table>
  <br>

</body>
</html>
